﻿//-----------------------------------------------------------------------
// <copyright file="Program.cs" company="FER">
//     Copyright (c) All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace TestDataImporter
{
    using System;
    using System.IO;
    using System.Reflection;

    using NMBP.DAL;

    /// <summary>
    /// Application which imports data to database
    /// </summary>
    public class Program
    {
        /// <summary>
        /// Main thread
        /// </summary>
        /// <param name="args">console arguments</param>
        public static void Main(string[] args)
        {
            var filePath = Directory.GetParent(
                           Directory.GetParent(
                           Directory.GetParent(
                           new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.ToString()).ToString()).ToString()) + 
                           "\\NMBP.DAL\\DatabaseFile\\projectDb.db";
            File.Delete(filePath);

            // hardcoded path for save
            DbFacade databaseFacade = new DbFacade(filePath);
            DataImporter dataImporter = new DataImporter();

            Console.WriteLine("Importing data.");

            dataImporter.ImportDepartments(databaseFacade);
            dataImporter.ImportPersons(databaseFacade);
            dataImporter.ImportProducts(databaseFacade);
            dataImporter.ImportSuppliers(databaseFacade);

            Console.WriteLine("Data imported.");
        }
    }
}
